<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="UTF-8"/>
        <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <title>tooltipster插件使用-事件</title>
        <link rel="stylesheet" href="css/tooltipster.bundle.css" />
        <style>
            .tooltip_template { display:none;width: 600px;height: 400px;background-color: #ccc; }
        </style>
    </head>
    <body>
        <span id="example" class="tooltip" title="This is my span's tooltip message!">example示例</span>
        <script src="http://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
        <script src="js/tooltipster.bundle.min.js"></script>
        <script>
        $(document).ready(function() {
           
            $('.tooltip').tooltipster();

            $('#example').tooltipster('open', function(instance, helper) {
                alert('The tooltip is now fully shown. Its content is: ' + instance.content());
            });
            
            $(window).keypress(function() {
                $('#example').tooltipster('close', function(instance, helper) {
                    alert('The tooltip is now fully hidden');
                });
            });
        });
        </script>
    </body>
</html>